Skip to content

feat(storage): support IAM authentication for S3 storage#358

Merged
dongmucat merged 1 commit intoiflytek:mainfrom
vzpd:feat/s3-iam-auth
Apr 29, 2026
Merged

feat(storage): support IAM authentication for S3 storage#358
dongmucat merged 1 commit intoiflytek:mainfrom
vzpd:feat/s3-iam-auth

Conversation

@vzpd
Copy link
Copy Markdown
Contributor

@vzpd vzpd commented Apr 29, 2026

Summary

  • When `access-key` / `secret-key` are left blank, fall back to the AWS `DefaultCredentialsProvider` chain so that deployments on EC2, ECS, and EKS can authenticate via instance profile, task role, or IRSA without static credentials.
  • Fully backward compatible — existing deployments with static credentials are not affected.

Changes

  • Extract `buildCredentialsProvider()` in `S3StorageService`: uses `StaticCredentialsProvider` when keys are set, `DefaultCredentialsProvider` otherwise.
  • Add `software.amazon.awssdk:sts` dependency (required for EKS Web Identity Token / IRSA).
  • Add unit tests for credential provider selection (static keys, blank keys, null keys, partial keys).
  • Update storage-spi docs (zh + en) and `.env.release.example` with IAM auth usage.

Validation

  • Backend tests passed (`mvn test -pl skillhub-storage -am` — 20 tests, 0 failures)
  • Full project compile passed (`mvn compile -pl skillhub-app -am` — all 7 modules)
  • Verified `DefaultCredentialsProvider` resolves env var credentials correctly
  • Verified graceful error when no credentials are available (no NPE, clear error message)
  • Frontend typecheck/build passed — no frontend changes
  • OpenAPI SDK regenerated or checked — no API contract changes

Commands run:

```bash

Unit tests

docker run --rm -v ./server:/workspace -w /workspace maven:3.9-eclipse-temurin-21
mvn test -pl skillhub-storage -am --batch-mode

Full compile

docker run --rm -v ./server:/workspace -w /workspace maven:3.9-eclipse-temurin-21
mvn compile -pl skillhub-app -am --batch-mode
```

Risk

  • User-facing impact: None for existing users. New capability for AWS IAM users.
  • Deployment or migration impact: None. Existing env vars continue to work as-is.
  • Rollback approach: Revert this commit. No data migration needed.

Notes

  • Related issue: N/A
  • Follow-up work: None
  • Docs updated: `storage-spi.md` (zh + en), `.env.release.example`

When access-key / secret-key are left blank, fall back to the AWS
DefaultCredentialsProvider chain so that deployments on EC2, ECS,
and EKS can authenticate via instance profile, task role, or IRSA
without static credentials.

- Extract buildCredentialsProvider() in S3StorageService
- Add sts dependency for Web Identity Token (EKS) support
- Add unit tests for credential provider selection
- Update storage-spi docs (zh + en) and env example
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 29, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Collaborator

@dongmucat dongmucat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,感谢这个 PR!

OIDC 接入的设计很干净:复用现有 OAuth2 的准入、绑定和会话链路,不需要新表、不改前端,claims 映射逻辑清晰,测试覆盖也到位。文档中英文同步更新、registration ID 冲突警告这些细节都考虑到了,很用心。

可以合并。

@dongmucat dongmucat merged commit de8d17a into iflytek:main Apr 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants